home *** CD-ROM | disk | FTP | other *** search
- **************** Bob-Competition **********************
- * *
- * 199 Bobs ! *
- * technical infos: *
- * - 320 x 200 screen *
- * - bobs are moved on the whole(!) screen *
- * - bobsize: 15 x 15 x 2 planes *
- * - bobs are masked out (MINTERM: $xfca) *
- * - real-time calculation of positions *
- * (no precalculated positionlist !) *
- * - calculation done by blitter (no joke !) *
- * - waves can be changed with the right mbutton *
- * *
- * PS: *
- * do not try to code in the style of this bobdemo, *
- * it is just so bad because i fought for every *
- * piece of raster-time... *
- * the small green line displays the *
- * remaining raster-time (not that much !) *
- * *
- * (c) '90 by MIC/L4 *
- *********************************************************
- balls = 199
-
- balldaten = $70000+[64*2*200]
- ballmasken = balldaten+[balls*15*4]
-
- anz_tabs = 17
-
- ytable = $60000+[64*2*200]
- xtable = ytable+[200*2*anz_tabs]
- shifttable = xtable+[320*2*anz_tabs]
-
- bl = 215
- pl = 400-bl
- ;------ macros -----
- wblit: macro
- wblit?0:
- btst #14,$2(a5)
- bne.s wblit?0
- endm
-
- jmp start
-
- org $40000
- load $40000
- d:
- start:
- move.l 4.w,a6
- lea grafname(pc),a1
- jsr -408(a6)
- move.l d0,a1
- move.l 38(a1),oldcopper
- jsr -414(a6)
-
- move.w $dff002,olddma
- or.w #$8000,olddma
- move.w $dff01c,oldint
- or.w #$8000,oldint
-
- move.w #$7fff,$dff09a
- move.w #$7fff,$dff096
-
- bsr.l prog_begin
-
- move.l oldcopper(pc),$dff080
-
- move.w #$7fff,$dff09a
- move.w #$7fff,$dff096
-
- move.l oldcopper(pc),$dff080
- clr.w $dff088
-
- move.w olddma(pc),$dff096
- move.w oldint(pc),$dff09a
-
- rts
-
- prog_begin:
- lea $60000,a0
- lea $80000,a1
- moveq #0,d0
- clr_all:
- move.l d0,(a0)+
- cmp.l a1,a0
- blt.s clr_all
-
- bsr.l init_balls
- bsr.l init_clear
- bsr.l init_curve
- bsr.l init_customregs
-
- lea make_back1(pc),a3
- bra.l make_offsets
- make_back1:
-
- move.l #clist,$dff080
- clr.w $dff088
- move.w #$87c0,$dff096
-
- move.l a7,stack
- sync:
- cmp.b #238,$dff006
- bne.s sync
- lea $dff000,a5
- lea d(pc),a4
- wblit
- mouse:
- cmp.b #238,$6(a5)
- blt.s mouse
-
- move.w #0,$180(a5)
-
- move.l physbase(pc),a3
-
- move.w #$0100,$40(a5)
- move.w #24,$66(a5)
- move.l a3,$54(a5)
- move.w #bl*64+20,$58(a5) ;mit blitter loeschen
-
- lea bl*64(a3),a3
-
- moveq #0,d0
- move.l d0,d1
- move.l d0,d2
- move.l d0,d3
- move.l d0,d4
- move.l d0,d5
- move.l d0,d6
- move.l d0,a0
- move.l d0,a1
- move.l d0,a2
- movem.l d0-d6/a0-a2,(a3)
- clear_proz:
- movem.l d0-d6/a0-a2,64(a3)
- clear_proz_list:
- blk.w [pl-2]*3,0
-
- move.w logbase(pc),d1
- move.w physbase(pc),logbase-d(a4) ;lo-wort immer gleich
- move.w d1,physbase-d(a4)
- move.w d1,$e0(a5) ;set hi-pointers
- move.w d1,$e4(a5)
-
- movem.l curve_xpt(pc),a0-a2
- add_x:
- lea 2(a0),a0 ;add.w xspeed,a0
- add_shift:
- lea 2(a1),a1 ;add.w shiftspeed,a1
- cmp.l #xtable+[320*2],a0
- blt.s curves_ok
- lea -[320*2](a0),a0 ;x-overflow -> shift-overflow
- lea -[640*2](a1),a1
- curves_ok:
- add_y:
- lea 2(a2),a2 ;add.w yspeed,a2
- cmp.l #ytable+[200*2],a2
- blt.s curves2_ok
- lea -[200*2](a2),a2
- curves2_ok:
- movem.l a0-a2,curve_xpt-d(a4)
-
- lea $40(a5),a0 ;hit it !!
- move.l #$0dfc0000,(a0)+ ;bltcon, a+b verodern
- moveq #-1,d0 ;=$ffffffff
- move.l d0,(a0)+ ;bltafwm
- move.l curve_xmod(pc),$62(a5) ;bmod+amod (xmod,ymod)
- move.w #12,$66(a5)
- addq.w #4,a0 ;$48+4 = $4c
- move.l curve_xpt(pc),(a0)+ ;bpt
- move.l curve_ypt(pc),(a0)+ ;apt
- move.l #blit_bobs_rout+6,(a0)+ ;dpt
- move.w #balls*64+1,(a0) ;blitsize
- blit_bobs:
- move.w #$0000,$46(a5) ;bltalwm
- move.l #[60*$10000]+$10000-2,$60(a5) ;cmod+bmod
- move.l #[-2*$10000]+60,$64(a5) ;amod+dmod
-
- move.l #ballmasken,$50(a5) ;apt
- move.l #balldaten,$4c(a5) ;bpt
-
- lea $40(a5),a0 ;bltcon0+1
- lea $48(a5),a2 ;cpt-lo
- lea $54(a5),a3 ;dpt-lo und blitsize
-
- move.w logbase(pc),(a2)+ ;logbase -> cpt-hi
- move.w logbase(pc),(a3)+ ;logbase -> dpt-hi
-
- move.w #15*2*64+2,d1 ;blitsize
- move.l curve_shiftpt(pc),a1
- blit_bobs_rout:
- move.l 2(a1),(a0) ;offsets werden geaendert
- move.w #0,d0 ;ziel
- move.w d0,(a2) ;cpt-lo
- movem.w d0/d1,(a3) ;dpt-lo und blitsize
- blit_bobs_list:
- blk.b blit_bobs_list-blit_bobs_rout*[balls-1],0
- blit_bobs_end:
- btst #10,$16(a5)
- bne.s no_rightbutton
-
- tst.b right_down-d(a4)
- bne.s no_rightbutton2 ;falls bereits gedrueckt !
-
- lea make_back2(pc),a3
- bra.l make_offsets
- make_back2:
- st right_down
- bra.l sync ;neu syncronisieren
- no_rightbutton:
- sf right_down-d(a4)
- no_rightbutton2:
-
- move.w #$0f0,$180(a5)
-
- btst #6,$bfe001
- bne.L mouse
-
- move.l stack(pc),a7
- rts
-
- stack: dc.l 0
- right_down: dc.b 0
- even
-
- st = shifttable
- xt = xtable
- yt = ytable
-
- curve_pt: dc.l c1
- curve_tab: ;st,xt,yt,xmod,ymod,xspeed,yspeed,next_one
- c1: dc.w 4,8,2,2
- dc.l c2
- c2: dc.w 2,2,4,6
- dc.l c3
- c3: dc.w 4,2,4,6
- dc.l c4
- c4: dc.w 12,0,2,2
- dc.l c5
- c5: dc.w 18,28,2,2
- dc.l c6
- c6: dc.w 8,10,4,2
- dc.l c7
- c7: dc.w 10,8,2,2
- dc.l c1
-
- curve_xmod: dc.w 4
- curve_ymod: dc.w 8
- xspeed: dc.w 4
- yspeed: dc.w 2
- curve_xpt: dc.l xtable
- curve_shiftpt: dc.l shifttable
- curve_ypt: dc.l ytable
- shiftspeed: dc.w 8
-
- make_offsets:
- move.l curve_pt(pc),a0
- movem.l (a0)+,d0-d2
- lea xtable,a0
- lea shifttable,a1
- lea ytable,a2
- movem.l d0-d1/a0-a2,curve_xmod
- move.l d2,curve_pt
-
- move.w xspeed(pc),d0
- add.w d0,d0
- move.w d0,shiftspeed
-
- move.w xspeed(pc),add_x+2
- move.w shiftspeed(pc),add_shift+2
- move.w yspeed(pc),add_y+2
-
- lea blit_bobs_rout+2(pc),a0
- move.w #balls-1,d0
- moveq #0,d1
- move.w curve_xmod(pc),d2
- add.w d2,d2 ;*2
- addq.w #4,d2 ;+4 wegen blittermodulo
- move.w #320*4,d3
- moveq #14,d4
- make_offl:
- move.w d1,(a0)
- add.w d2,d1
- add.l d4,a0 ;+14
- dbra d0,make_offl
-
- jmp (a3) ;zurueck
-
- init_clear:
- lea clear_proz,a0
- lea clear_proz_list,a1
- lea clear_proz+[[pl-1]*6],a2 ;ende
- init_clr_l:
- move.w (a0)+,(a1)+
- cmp.l a2,a1
- blt.s init_clr_l
-
- lea clear_proz+4,a0
- move.w #pl-2,d0
- moveq #64,d1
- init_clr_offs:
- move.w d1,(a0)
- add.w #64,d1
- addq.w #6,a0
- dbra d0,init_clr_offs
-
- rts
-
- init_curve:
- lea ytable,a0
- moveq #anz_tabs-1,d0
- init_cu1:
- lea y_tab,a1
- move.w #200-1,d1
- init_cu2:
- move.w (a1)+,d2
- lsl.w #7,d2 ;*128
- move.w d2,(a0)+
- dbra d1,init_cu2
- dbra d0,init_cu1
-
- lea xtable,a0
- moveq #anz_tabs-1,d0
- init_cu3:
- lea x_tab,a1
- move.w #320-1,d1
- init_cu4:
- move.w (a1)+,(a0)+
- dbra d1,init_cu4
- dbra d0,init_cu3
-
- lea shifttable,a0
- moveq #anz_tabs-1,d0
- init_cu5:
- lea shift_tab,a1
- move.w #320-1,d1
- init_cu6:
- move.w (a1)+,d2
- move.w d2,(a0)+ ;bltcon 0
- and.w #$f000,d2 ;fuer bltcon 1
- move.w d2,(a0)+
- dbra d1,init_cu6
- dbra d0,init_cu5
-
- rts
-
- init_balls:
- lea balldaten,a2
- lea ballmasken,a3
- move.w #balls-1,d0
- init_balls_l:
- lea ball_dat,a0
- lea ball_mask,a1
- moveq #15-1,d1
- init_balls_l2:
- move.l (a0)+,(a2)+ ;daten
- move.l (a1)+,(a3)+ ;masken
- dbra d1,init_balls_l2
- dbra d0,init_balls_l
-
- lea blit_bobs_rout(pc),a0
- lea blit_bobs_list(pc),a1
- lea blit_bobs_end,a2
- copy_blit_rout:
- move.w (a0)+,(a1)+
-
- cmp.l a2,a1
- blt.s copy_blit_rout
- rts
-
- grafname: dc.b "graphics.library",0
- even
- oldcopper: dc.l 0
- olddma: dc.w 0
- oldint: dc.w 0
-
- logbase: dc.l $60000
- physbase: dc.l $70000
-
- init_customregs:
- lea $dff000,a0
- move.w #$2981,$8e(a0)
- move.w #$f1c1,$90(a0) ;screenhoehe,breite
- move.w #$0038,$92(a0) ;ddf-start
- move.w #$00d0,$94(a0) ;ddf-stop
- move.w #128-40,$108(a0)
- move.w #128-40,$10a(a0) ;screen-modulos
- move.w #0,$104(a0) ;prioritaet
- move.w #0,$102(a0)
- move.w #0,$144(a0)
- move.w #0,$146(a0) ;sprites aus
- move.w #$ffff,$2e(a0) ;blits durch copper !
- move.w #$000,$180(a0)
- move.w #$0fe,$182(a0)
- move.w #$05c,$184(a0)
- move.w #$017,$186(a0)
- move.w #$2200,$100(a0)
-
- rts
-
- clist:
- c_scpt:
- dc.l $00e20000
- dc.l $00e60040 ;planes
-
- dc.l $fffffffe
-
- shift_tab:
- DC.L $9FCABFCA,$EFCA1FCA,$4FCA7FCA,$AFCADFCA,$0FCA3FCA
- D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CA
- DC.L $DFCABFCA,$9FCA7FCA,$5FCA3FCA,$1FCAFFCA,$EFCACFCA
- DC.L $AFCA8FCA,$7FCA5FCA,$4FCA2FCA,$1FCA0FCA,$EFCADFCA
- DC.L $CFCABFCA,$AFCA9FCA,$8FCA7FCA,$6FCA5FCA,$5FCA4FCA
- DC.L $3FCA3FCA,$2FCA2FCA,$2FCA1FCA,$1FCA1FCA,$1FCA1FCA
- DC.L $0FCA1FCA,$1FCA1FCA,$1FCA1FCA,$2FCA2FCA,$2FCA3FCA
- DC.L $3FCA4FCA,$5FCA5FCA,$6FCA7FCA,$8FCA9FCA,$AFCABFCA
- DC.L $CFCADFCA,$EFCA0FCA,$1FCA2FCA,$4FCA5FCA,$7FCA8FCA
- DC.L $AFCACFCA,$EFCAFFCA,$1FCA3FCA,$5FCA7FCA,$9FCABFCA
- DC.L $DFCAFFCA,$1FCA4FCA,$6FCA8FCA,$AFCADFCA,$FFCA2FCA
- DC.L $4FCA7FCA,$9FCACFCA,$EFCA1FCA,$3FCA6FCA,$9FCACFCA
- DC.L $EFCA1FCA,$4FCA7FCA,$AFCACFCA,$FFCA2FCA,$5FCA8FCA
- DC.L $BFCAEFCA,$1FCA4FCA,$7FCAAFCA,$DFCA0FCA,$3FCA6FCA
-
- y_tab:
- DC.L $00B900B8,$00B800B8,$00B800B7,$00B700B6,$00B600B5
- DC.L $00B400B3,$00B200B1,$00B000AE,$00AD00AC,$00AA00A9
- DC.L $00A700A5,$00A300A2,$00A0009E,$009B0099,$00970095
- DC.L $00930090,$008E008B,$00890086,$00840081,$007E007C
- DC.L $00790076,$00730071,$006E006B,$00680065,$0062005F
- DC.L $005D005A,$00570054,$0051004E,$004B0048,$00460043
- DC.L $0040003D,$003B0038,$00350033,$0030002E,$002B0029
- DC.L $00260024,$00220020,$001E001B,$00190017,$00160014
- DC.L $00120010,$000F000D,$000C000B,$00090008,$00070006
- DC.L $00050004,$00030003,$00020002,$00010001,$00010001
- DC.L $00000001,$00010001,$00010002,$00020003,$00030004
- DC.L $00050006,$00070008,$0009000B,$000C000D,$000F0010
- DC.L $00120014,$00160017,$0019001B,$001E0020,$00220024
- DC.L $00260029,$002B002E,$00300033,$00350038,$003B003D
- DC.L $00400043,$00460048,$004B004E,$00510054,$0057005A
- DC.L $005C005F,$00620065,$0068006B,$006E0071,$00730076
- DC.L $0079007C,$007E0081,$00840086,$0089008B,$008E0090
- DC.L $00930095,$00970099,$009B009E,$00A000A2,$00A300A5
- DC.L $00A700A9,$00AA00AC,$00AD00AE,$00B000B1,$00B200B3
- DC.L $00B400B5,$00B600B6,$00B700B7,$00B800B8,$00B800B8
-
- x_tab:
- DC.L $00120012,$00120014,$00140014,$00140014,$00160016
- DC.L $00160016,$00160016,$00180018,$00180018,$0018001A
- DC.L $001A001A,$001A001A,$001A001C,$001C001C,$001C001C
- DC.L $001C001C,$001E001E,$001E001E,$001E001E,$00200020
- DC.L $00200020,$00200020,$00200020,$00220022,$00220022
- DC.L $00220022,$00220022,$00220022,$00240024,$00240024
- DC.L $00240024,$00240024,$00240024,$00240024,$00240024
- DC.L $00240024,$00240024,$00240026,$00260026,$00260026
- DC.L $00260026,$00260026,$00260026,$00240024,$00240024
- DC.L $00240024,$00240024,$00240024,$00240024,$00240024
- DC.L $00240024,$00240024,$00240022,$00220022,$00220022
- DC.L $00220022,$00220022,$00220020,$00200020,$00200020
- DC.L $00200020,$0020001E,$001E001E,$001E001E,$001E001C
- DC.L $001C001C,$001C001C,$001C001C,$001A001A,$001A001A
- DC.L $001A001A,$00180018,$00180018,$00180016,$00160016
- DC.L $00160016,$00160014,$00140014,$00140014,$00120012
- DC.L $00120012,$00120012,$00100010,$00100010,$0010000E
- DC.L $000E000E,$000E000E,$000C000C,$000C000C,$000C000C
- DC.L $000A000A,$000A000A,$000A000A,$00080008,$00080008
- DC.L $00080008,$00060006,$00060006,$00060006,$00060004
- DC.L $00040004,$00040004,$00040004,$00040002,$00020002
- DC.L $00020002,$00020002,$00020002,$00020002,$00000000
- DC.L $00000000,$00000000,$00000000,$00000000,$00000000
- DC.L $00000000,$00000000,$00000000,$00000000,$00000000
- DC.L $00000000,$00000000,$00000000,$00000000,$00000000
- DC.L $00000000,$00000000,$00000000,$00000000,$00000000
- DC.L $00000000,$00000002,$00020002,$00020002,$00020002
- DC.L $00020002,$00020002,$00040004,$00040004,$00040004
- DC.L $00040004,$00060006,$00060006,$00060006,$00060008
- DC.L $00080008,$00080008,$0008000A,$000A000A,$000A000A
- DC.L $000A000C,$000C000C,$000C000C,$000C000E,$000E000E
- DC.L $000E000E,$00100010,$00100010,$00100012,$00120012
-
- ball_dat: ;15x15 ball, 2 planes, raw-blit
- dc.l $07c007c0,$14f01cf0,$12382e38
- dc.l $7a2c463c,$12346e3c,$c432fc3e,$b822b83e,$806a8076
- dc.l $806a8076,$c3cec3f6,$5f147fec,$606c7f9c,$33983c78
- dc.l $1c701ff0,$07c007c0
-
- ball_mask: ;maske des balls (farbe 0 mitverwendet)
- dc.l $07c007c0,$1ff01ff0,$3ff83ff8,$7ffc7ffc,$7ffc7ffc
- dc.l $fffefffe,$fffefffe,$fffefffe,$fffefffe,$fffefffe
- dc.l $7ffc7ffc,$7ffc7ffc,$3ff83ff8,$1ff01ff0,$07c007c0
-
- End:
-